import request from '@/utils/http'

export const getCategoryListAPI = () => {
    return request({
        url: '/getCategoryList',
        method: 'get',

    })
}
export const getGoodListByCidAPI = (cid) => {
    return request({
        url: '/getGoodListByCid',
        method: 'post',
        data: {
            cid
        }
    })
}
export const getSellingGoodListByCidAPI = (cid) => {
    return request({
        url: '/getSellingGoodListByCid',
        method: 'post',
        data: {
            cid
        }
    })
}
export const updateGoodInfoAPI = (goodInfo) => {
    return request({
        url: '/updateGoodInfo',
        method: 'post',
        data: {
            gid: goodInfo.gid,
            gname: goodInfo.gname,
            price: goodInfo.price,
            desc: goodInfo.desc,
            src: goodInfo.src,
            num: goodInfo.num,
            state: goodInfo.state
        }
    })
}
export const getGoodListByContentAPI = (content) => {
    return request({
        url: '/getGoodListByContent',
        method: 'post',
        data: {
            content
        }
    })
}
export const getSellingGoodListByContentAPI = (content) => {
    return request({
        url: '/getSellingGoodListByContent',
        method: 'post',
        data: {
            content
        }
    })
}
export const getGoodListByContentStateCidAPI = (content, state, cid) => {
    return request({
        url: '/getGoodListByContentStateCid',
        method: 'post',
        data: {
            content,
            state,
            cid
        }
    })
}
export const addCategoryAPI = (cname) => {
    return request({
        url: '/addCategory',
        method: 'post',
        data: {
            cname
        }
    })
}
export const addGoodAPI = (goodInfo) => {
    return request({
        url: '/addGood',
        method: 'post',
        data: {
            gname: goodInfo.gname,
            price: goodInfo.price,
            desc: goodInfo.desc,
            src: goodInfo.src,
            num: goodInfo.num,
            state: goodInfo.state,
            cid: goodInfo.cid
        }
    })
}